<{include file="header.html"}>
<script type="text/javascript">
	
	function validate()
	{
		var firstname = document.getElementById('FIRST_NAME');
        var lastname = document.getElementById('FIRST_NAME');
        var phone = document.getElementById('PHONE');
        var email = document.getElementById('EMAIL');
		var reemail = document.getElementById('REEMAIL');
        

		// checking NAME
		if(isEmptyTextBox(firstname, '<{$smarty.const._LB_FIRSTNAME_IS_EMPTY|utf8_escape_js}>'))
			return false;

		if(!isValidLengthTextBox(firstname, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._LB_FIRSTNAME_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(isEmptyTextBox(lastname, '<{$smarty.const._LB_LASTNAME_IS_EMPTY|utf8_escape_js}>'))
			return false;

		if(!isValidLengthTextBox(lastname, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._LB_LASTNAME_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidLengthTextBox(phone, <{$smarty.const.MAX_LENGTH_NAME}>, "<{$smarty.const._MSG_TELEPHONE_IS_TOO_LONG|utf8_escape_js}>"))
		{
			return false;
		}
        
        if(isEmptyTextBox(email, '<{$smarty.const._LB_EMAIL_IS_EMPTY|utf8_escape_js}>'))
			return false;
        if(!isValidLengthTextBox(email, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._MSG_EMAIL_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidEmail(email,'<{$smarty.const._LB_INVALID_EMAIL|utf8_escape_js}>')){
            return false;
        }
		if(email.value != reemail.value){
			showErrorBubble(email, '<{$smarty.const._LB_EMAIL_DOESNT_MATCH|utf8_escape_js}>');
			return false;
		}
		if(phone.value != "" && !validatephonenumber(phone,'<{$smarty.const._LB_INVALID_PHONE_OR_EMPTY|utf8_escape_js}>')){
			return false;
		}
        
        <{if !$member->ID}>
        var pass = document.getElementById('PASS');
        var repass = document.getElementById('REPASS');
        
        
        if(isEmptyTextBox(pass, '<{$smarty.const._LB_PASSWORD_IS_EMPTY|utf8_escape_js}>'))
			return false;
        
        if(!isValidLengthTextBox(pass, <{$smarty.const.MAX_LENGTH_PASSWORD}>, '<{$smarty.const._MSG_PASSWORD_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidMinLengthTextBox(pass, <{$smarty.const.MIN_LENGTH_PASSWORD}>, '<{$smarty.const._MSG_PASSWORD_IS_TOO_SHORT|utf8_escape_js}>')){
            return false;
        }
        
        if(pass.value != repass.value){
            showErrorBubble(pass, '<{$smarty.const._LB_PASSWORD_DOESNT_MATCH|utf8_escape_js}>');
            return false;
        }
        <{/if}>
        // check whether or not email exist
		var agr = new Array();
		agr.push(email.value);
		agr.push('<{$member->ID}>');

		if(callFunction("Member::emailExistByLoginID", agr))
		{
			showErrorBubble(email, "<{$smarty.const._MSG_EXIST_EMAIL|utf8_escape_html}>" );
			return false;
		}
		document.user_form.submit();
	}



</script>

<div id="content">
    <div class="container">
        <div class="main-content">
            <h1 class="title"><{$smarty.const._LB_REGISTER|utf8_escape_html}></h1>
            <form action="<{$smarty.server.REQUEST_URI}>" method="post" name="user_form" id="form-booking">
			<input type="hidden" id="ID" value="<{$member->ID}>"/>
			<input type="hidden" id="act" name="act" value="<{$smarty.const.ACT_VALID_EDIT}>"/>
			<div colspan="4"  style="padding-right: 20px;" align="right">
				<span class="powermail_mandatory">*</span> <{$smarty.const._LB_REQUIRE_INFORMATION|utf8_escape_html}>
			</div>
			<table>
				<tr>
					<td width="180"><{$smarty.const._LB_FIRST_NAME|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
					<td colspan="3"><input name="FIRST_NAME" id="FIRST_NAME" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$member->FIRST_NAME|utf8_escape_html}>" /></td>
				</tr>
				<tr>
					<td ><{$smarty.const._LB_LAST_NAME|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
					<td colspan="3"><input name="LAST_NAME" id="LAST_NAME" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$member->LAST_NAME|utf8_escape_html}>" /></td>
				</tr>
				<tr>
					<td ><{$smarty.const._LB_EMAIL|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
					<td colspan="3"><input name="EMAIL" id="EMAIL" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$member->EMAIL|utf8_escape_html}>" /></td>
				</tr>
				<tr>
					<td ><{$smarty.const._LB_REPEAT_EMAIL|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
					<td colspan="3"><input name="REEMAIL" id="REEMAIL" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$member->EMAIL|utf8_escape_html}>" /></td>
				</tr>
				<tr>
					<td ><{$smarty.const._LB_TELEPHONE|utf8_escape_html}>&nbsp;:&nbsp;</td>
					<td colspan="3"><input name="PHONE" id="PHONE" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$member->PHONE|utf8_escape_html}>" /> (<{$smarty.const._LB_PHONE_FORMAT|utf8_escape_html}>)</td>
				</tr>
				<{if !$member->ID}>
				<tr>
					<td ><{$smarty.const._LB_PASSWORD|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
					<td colspan="3"><input name="PASS" id="PASS" type="password" size="<{$smarty.const.SIZE_NAME}>" value="" /></td>
				</tr>
				<tr>
					<td ><{$smarty.const._LB_REPEAT_PASSWORD|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
					<td colspan="3"><input name="REPASS" id="REPASS" type="password" size="<{$smarty.const.SIZE_NAME}>" value="" /></td>
				</tr>
				<{/if}>
				<tr>
					<td ><{$smarty.const._LB_MEMBER_SUBSCRIBE_NEWSLETTER|utf8_escape_html}>&nbsp;:&nbsp;</td>
					<td colspan="3"><input type="checkbox" value="1" name="NEWSLETTER" <{if $member->NEWSLETTER}>checked<{/if}>/></td>
				</tr>
				<tr>
					<td ></td>
					<td class="submit" colspan="3" style="padding-top:10px"><br />
							<button type="reset" ><{$smarty.const._LB_RESET}></button>
							<button type="button" onclick="validate()"><{$smarty.const._LB_VALIDATE}></button>
					</td>
				</tr>
			</table>
			</form>
        </div>
        <div class="sidebar">
            <{include file="right_business_hours.html"}>
			<{include file="right_service.html"}>
        </div><!--End .sidebar-->
    </div>
</div>
<{include file="footer.html"}>